#ifndef WINDOW_H
#define WINDOW_H
#include <iostream>

class WidgetPrivate;
class GLFWwindow;
class Widget
{
public:
    enum WindMSG{ msg_repaint = 0,msg_unknow = 0xff};
    Widget(const std::string& title = "");
    virtual ~Widget();
    void setVersion(int major,int minor);
    void setTitle(const std::string&);
    void resize(int w,int h);
    void setText(const std::string&);
    void sendMessage(const WindMSG&);
    void show(size_t ms = 0xFFFFFFF);
    void swapBuffer();
    bool create();
    void drawText(const std::string& text);
    bool requestExit();
    void makeCurrent();
    void repaint();
protected:
    virtual void initializeGL();
    virtual void paintGL();
    virtual void resizeGL(int w, int h);
    void initializeOpenGLFunctions();
private:
    static void onWindowResized(GLFWwindow *, int, int);
    WidgetPrivate* d_ptr;
};

#endif
